package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.PendingTasksDto;
import com.zzyl.entity.PendingTasks;
import com.zzyl.service.ActFlowCommService;
import com.zzyl.utils.UserThreadLocal;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "待办任务管理")
@RestController
@RequestMapping("/pending_tasks")
public class PendingTasksController {

    @Autowired
    private ActFlowCommService actFlowCommService;


    /**
     * 查询待办任务/我的申请
     * @param dto
     * @return
     */
    @PostMapping("/selectByPage")
    public ResponseResult<PageResponse<PendingTasks>> selectByPage(@RequestBody PendingTasksDto dto){
        Long userId = UserThreadLocal.getMgtUserId();
        dto.setAssigneeId(userId);//操作人
        PageResponse<PendingTasks> pageResponse = actFlowCommService.myTaskList(dto);
        return ResponseResult.success(pageResponse);
    }

}
